<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>CS334: Windows Programming</title></head><body>

      <center><h3>
            Program 2: VB Classes
            <br>
            (20 points)
         </h3>
      </center>
      <h4>
         Program Description
      </h4>
      The VB program manages a list of house units to be built. There are three types 
      of houses: Platteville, Madison, and Chicago, and they are represented by three 
      classes, all of which are a subclass of an abstract class House.
      <p>
         The solution <b>must</b> have two projects: Project classHouses and Project 
         userProgram.
      </p>
<h4>
Project classHouses
</h4>
<ol>
<li>         This project defines the abstract class House and the three sub-classes. </li>

<li> The interface of the abstract class House is defined as follows:
     <ul>
     <li> Public Properties
            <ul>
               <li>
                  Type: read only, to return the type of each house. </li>
               <li>
                     ID: write-once and readable, to access a variable of string, whose length 
                     must be exactly 5 and each character must be a digit or a letter. </li>
               <li>
                        Rooms: read-write, to access a variable of integer. </li>
               <li>
                           Garages: read-write, to access a variable of integer. </li>
               <li>
                              Price: read only, to compute and return the price of the unit. </li>
               <li>
               TotalCount: shared, read-only, to access an integer variable, representing the 
               total count of houses. </li>
            </ul>
            </li>
     <li> Public Event
          <ul>
             <li>  Changed: raised when the price of a house has changed, one parameter for the 
               house ID. </li>
            </ul>
            </li>
            
      <li>  Protected Shared Variable
            <ul>
               <li> theCount: the value of total count of houses.</li> 
            </ul>
            </li>
      <li> Protected Method
           <ul>
           <li> HasChanged to raise event Changed</li>
           </ul>
           </li>
               <!--
   <dd> Increment to add one to the total count of house units
   <dd> Decrement to subtract one from the total count of house units
-->
       <li>
         Property ID and Rooms <b>must</b> be implemeneted in class House, while property Type <b>must</b> be a 
         virtual method and be implemented in the three subclasses. 
           </li>
       </ul>
</li>       
                    <!--
Public MustOverride ReadOnly Property type() As String

You must determine which methods should be virtual and implemented in the subclasses,
and which methods should be non-virtual and implemented in the base class.

<li> The house type is defined by an enumeration type, 
which has three values: Platteville, Madison, and Chicago.

   <li> The ID of each house must have .
-->
<li>
            The details of the three subclasses are given below, and their properties and 
            methods must be implemented accordingly:
     <ul>
     <li>
               For type Platteville, the number of rooms is between 2 and 3, the number of 
               garages is between 1 and 2. The base price for two-room and one-garage is 
               $150,000. The cost for the third room is $10,000, and the cost for the second 
               garage is $2,000. The subclass has a constructor without parameter.  </li>
     <li>
               For type Madison, the number of rooms is between 2 and 4, the number of garages 
               is between 1 and 3. The base price for two-room and one-garage is $185,000. The 
               cost for an additional room is $20,000, and the cost for an additional garage 
               is $3,000. The subclass has a constructor with one parameter for the ID. </li>
     <li>
               For type Chicago, the number of rooms is between 3 and 4, the number of garages 
               is between 2 and 3. The base price for three-room and two-garage is $300,000. 
               The cost for an additional room is $40,000, and the cost for an additional 
               garage is $5,000. The subclass has a constructor without parameter. </li>
     </ul>  
</li>
         <!--
<li> Each subclass must have a constructor with some parameters that will set
the properties and call Increment to update the total count of houses.
-->
<li>
         The properties of each class <b>must</b> validate the input data when setting the 
         corresponding values. When an invalid value is found, the class <b>must</b> raise an 
         error, which will be handled by the client code. </li>

<li>
         Each subclass must implement the IDisposable interface and update the total 
         count of houses inside sub Dispose. </li>

<li>
            <b>The root namespace must be UWPCS3340, the assembly name <b>must</b> be myClasses.</b>
         </li>
      </ol>
      
<h4>
         The Front-End Program
      </h4>
      <ol>
         <li>
         The project has two forms: frmHouse and frmList. Your forms should be similar 
         to that of the sample program. The project also has a code module, which 
         maintains a list of houses, in addition to other things. </li>
         <li>
         The title of frmHouse is "Program 2" followed by your name, its size is (770, 
         490), and boarderstyle is Fixed3D. The form has a text box for the user to 
         enter the ID of a house, a dropdown combo box to choose the house type, two 
         groups of radiobuttons to select the number of rooms and the number of garages, 
         a text box to display the price of the house. The user cannot modified the 
         price. The form also has five command buttons: cmdClear, cmdSave, cmdModify, 
         cmdList and cmdExit. </li>
         <li>
         When the form is loaded at the beginning, textbox ID has the focus, both ID and price are empty, no 
         selection is made to the type, rooms, or garages, and cmdModify is disabled. </li>
         <li>
         Clicking cmdClear will clear all previous values on the form and the user can 
         enter values for a new house. Button cmdModify will be disabled, while all 
         other buttons will be enabled. </li>
         <li>
         Clicking cmdSave will save a new house to the list of houses. Only when the 
         type is "Madison," the click event procedure should check the ID (not any other 
         values) in order to call the constructor with a parameter. The client code does 
         not validate any other values for the house, but must catch any error raised by 
         the class code. After a new house is saved successfully, button cmdSave will be disabled, 
         while other buttons will be enabled. </li>
         <li>
         Clicking cmdModify will save the changes made to the house displayed on the 
         form. The client code should just call the class methods without checking the input
         and catch any possible error.
         When the number of rooms and/or the number of garages of a house has been 
         modified, the price will be modified accordingly and the new price will be 
         displayed on the form. </li>
         <li>
         Clicking cmdExit will terminate the project. </li>
         <li>
         Clicking cmdList will display form frmList in the center of the screen. </li>
         <li>
         There should be an event handler to handle the event when the price has 
         changed. The procedure just dispalys a message box to indicate that the price 
         has changed. </li>
         <li>
         The title of frmList is "Program 2" followed by your name, its size is (660, 
         390), and boarderstyle is FixedSingle. The form has a textbox to display the 
         total count of houses, and a listbox to display the ID, Type and price of all 
         houses. The form has three command buttons: cmdDisplay, cmdRemove and cmdOK. </li>
         <li>
         Clicking cmdOK will hide frmList and show frmHouse. </li>
         <li>
         Clicking cmdRemove will remove the selected house from the list. If the house 
         was displayed on frmHouse, then frmHouse should be clear and be ready for user 
         to enter a new house. </li>
         <li>
         Clicking cmdDisplay will display the data of the selected house on frmHouse and 
         frmHouse will be ready for user to modify. </li>
         <li>
         The user should select a house before clicking cmdDisplay or cmdRemove. If no 
         house is selected, then a message box will be displayed. </li>
         <li>
            The total count of houses should be updated when a house is added or removed, 
            no matter which form is displayed. You have to use the shared property to 
            display the total count of houses.
         </li>
      </ol>
      
      
<h4> Submission      </h4>
<ol>
<li> You must do the program in pairs. You must also sign a pairing sheet, and one student of each 
pair will be designated as the submitter. </li>
<li> You must have a different partner from prog1. </li>

<li>   Use your UserName to name the solution folder. Both projects should be under the solution folder. </li>

<li> Drop your solution folder to folder Prog2 of the class DROP folder by 11 PM, Tuesday, February 20, 2007. </li>

<li> You must send an email to the instructor with a brief peer evaluation of your partner by 11 PM, Febraury, Feb 20, 2007. </li>

<li> You may lose up to two points for incorrect submission, including missing email and incorrect folder name. </li>

<li> You must follow the programming rules, and you may lose up to 2 points on style. </li>

</ol>

</body></html>